﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/TemplateAdmin.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="ManageBanking.Areas.Admin.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScrip" runat="server">
<link href="../../../../Content/css/SucErr1.css" rel="stylesheet" type="text/css" />

    <script src="../../../../Scripts/wysiwyg.js" type="text/javascript"></script>
    <script src="../../../../Scripts/functions.js" type="text/javascript"></script>
    <script src="../../../../Scripts/smartpaginator.js" type="text/javascript"></script>

    <link href="../../../../Content/css/smartpaginator.css" rel="stylesheet" type="text/css" />
    <script src="../../../../Scripts/JTPS.js" type="text/javascript"></script> 
      
      <script type="text/javascript" language="javascript">

          $(document).ready(function() {

              $('#empTable').jTPS({ clickCallback: function() {
                  // target table selector
                  var table = '#empTable';
                  // store pagination + sort in cookie 
                  document.cookie = 'jTPS=sortasc:' + $(table + ' .sortableHeader').index($(table + ' .sortAsc')) + ',' +
                                                'sortdesc:' + $(table + ' .sortableHeader').index($(table + ' .sortDesc')) + ';';
                  $('.stubCell').remove();
              }
              });


              // reinstate sort and pagination if cookie exists
              var cookies = document.cookie.split(';');
              for (var ci = 0, cie = cookies.length; ci < cie; ci++) {
                  var cookie = cookies[ci].split('=');
                  if (cookie[0] == 'jTPS') {
                      var commands = cookie[1].split(',');
                      for (var cm = 0, cme = commands.length; cm < cme; cm++) {
                          var command = commands[cm].split(':');
                          if (command[0] == 'sortasc' && parseInt(command[1]) >= 0) {
                              $('#empTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click();
                          } else if (command[0] == 'sortdesc' && parseInt(command[1]) >= 0) {
                              $('#empTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click().click();
                          }
                      }
                  }
              }
              $('.stubCell').remove();
              // bind mouseover for each tbody row and change cell (td) hover style
              $('#empTable tbody tr:not(.stubCell)').bind('mouseover mouseout',
                                function(e) {
                                    // hilight the row
                                    e.type == 'mouseover' ? $(this).children('td').addClass('hilightRow') : $(this).children('td').removeClass('hilightRow');
                                }
                        );

          });

     
 </script>
    
    <script type="text/javascript">
        $(document).ready(function() {
            
            $("select#perpage").change(function() {
                var str;
                $("select option:selected").each(function() {
                    str = parseInt($(this).text());
                });
            

                $('#red').smartpaginator({ totalrecords: $('input#totaluser').attr('value'), recordsperpage: str, length: 4, datacontainer: 'empTable', dataelement: 'tr', next: 'Next', prev: 'Prev', first: 'First', last: 'Last', theme: 'black', controlsalways: true, onchange: function(newPage) {
                    $('#r').html('Page # ' + newPage);
                }
                });

                $('.short').remove();


            }).change();


            // kiem tra dialog delete
            $('a.icon-2').click(function() {
                return confirm('Are you sure Delete ?');
            });

            // kiem tra dialog update
            $('input#ud').click(function() {
                return confirm('Are you sure Update ?');
            });
            
        });
    </script>
    
     <!------ search ------->
    <script type="text/javascript">
        $(document).ready(function() {
            $('ul#search_user1').remove();
        });
        
        
    </script>
    <!-------- End Search------------->
    

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% ManageAdminModels mam = new ManageAdminModels(); %>
 <% if (ViewData["Check"] == "true")
              {
                  %>
         <div class="succes">
					<div class="succes_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Success!</span>
						<p>Your Action Is Success!!!</p>
					</div>
				</div>
				<div class="clear"><!-- --></div>   
				<%} %>
				<%else if (ViewData["Check"]!=null){ %>
				<div class="err">
					<div class="err_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Error!</span>
						<p><%=ViewData["Check"]%></p>
					</div>
				</div>
				<%} %>
    <table id="empTable" border="0"  cellpadding="0" cellspacing="0" >
	<tr>
		<th sort="index"  class="table-header-check th-username"><a>Username</a>	</th>
		<th sort="description" class="table-header-repeat line-left th-email"><a>Email</a></th>
		<th class="table-header-repeat line-left th-lock"><a>Lock</a></th>
		<th class="table-header-options line-left th-option"><a>Options</a></th>
	</tr>
	
	
	<%  int dem = 1;
        List<Username> lun = (List<Username>)ViewData["listuser"];
        foreach(Username un in lun ) 
        {
            dem ++;
            if(dem%2==0)
            {%>
	            <tr>
		            <td ><%= un.Username1 %></td>
		            <td ><%= un.Email %></td>
		            <td align="center" class="lock">
		                <% using (Html.BeginForm("Update", "ManageUserAdmin"))
                     {%>
		                <select id="Select1" name="lockuser">
		                    <option <%=  Convert.ToBoolean(un.Lock)==true ? "selected=selected" : "" %> value="true">Lock</option>
		                    <option <%=  Convert.ToBoolean(un.Lock)==false ? "selected=selected" : "" %> value="false">Unlock</option>
		                </select>
		                
		                <input type="hidden" name="idusername" value='<%= un.IdUsername %>' />                    
		                <input type="hidden" name="page" value="pagepaging" />
		               </td>
		             
		             
		            <td class="options-width">
                        <input id="Submit1" type="submit"  value="" class="icon-1" title="Update"/> 
                        
                        <%} %>
                        
                        <label title="Delete"><a  href='<%=Url.Action("Delete/"+un.IdUsername,"ManageUserAdmin") %>'  class="icon-2"></a></label>
                        <label title="Information"><a href='<%=Url.Action("InformationUsername/"+un.IdUsername,"ManageUserAdmin") %>'  class="icon-5 info-tooltip"></a></label>
		            </td>
	            </tr>
	        <% }
	        else
	        {%>
	            <tr class="alternate-row">
		            <td ><%= un.Username1 %></td>
		            <td ><%= un.Email %></td>
		            <td align="center" class="lock">
		                <% using (Html.BeginForm("Update", "ManageUserAdmin"))
                     {%>
		                <select id="Select2" name="lockuser">
		                    <option <%=  Convert.ToBoolean(un.Lock)==true ? "selected=selected" : "" %> value="true">Lock</option>
		                    <option <%=  Convert.ToBoolean(un.Lock)==false ? "selected=selected" : "" %> value="false">Unlock</option>
		                </select>
		                
		                <input type="hidden" name="idusername" value='<%= un.IdUsername %>' />                    
		                <input type="hidden" name="page" value="pagepaging" />
		               </td>
		             
		             
		            <td class="options-width">
                        <input id="Submit2" type="submit"  value="" class="icon-1" title="Update"/> 
                        
                        <%} %>
                        
                        <label title="Delete"><a  href='<%=Url.Action("Delete/"+un.IdUsername,"ManageUserAdmin") %>'  class="icon-2"></a></label>
                        <label title="Information"><a href='<%=Url.Action("InformationUsername/"+un.IdUsername,"ManageUserAdmin") %>'  class="icon-5 info-tooltip"></a></label>
		            </td>
	            </tr>
	            
	<%  
            }
        }
	     %>
	</table>
	<!--  end product-table................................... --> 
	

    <!--  start paging..................................................... -->
	<div id="red" style="margin: auto;">
	     <input id="totaluser" type="hidden" value='<%= ViewData["totaluser"]%>'  />
	</div>
	
	<div id="drop" >
	    <select id="perpage" >   
            <option value="2">2</option>
			<option selected="selected" value="5">5</option>
			<option value="10">10</option>
			<option value="15">15</option>
			<option value="20">20</option>
			<option value="30">30</option>
		</select>
	</div>
    
	<!--  end paging................ -->

    

</asp:Content>


